#ifndef _INCLUDE_CONSOLE_H
#define _INCLUDE_CONSOLE_H
#include <stdint.h>

/********************Console Configuration START********************/

//#define CONSOLE_USE_ASNYC_SEND  //Enable async send
#define CONSOLE_USE_ASNYC_RECV  //Enable async receive

#define CONSOLE_TX_RBUF_SIZE 256 //TX ring buffer size
#define CONSOLE_TX_LBUF_SIZE 64 //TX line buffer size

#define CONSOLE_RX_RBUF_SIZE 64 //RX ring buffer size
#define CONSOLE_RX_LBUF_SIZE 64 //RX line buffer size

/********************Console Configuration END********************/

typedef struct console_dev_ops
{
    int32_t (*start_send)(uint8_t *buff, int32_t size);
    int32_t (*stop_send)(void);
    
    int32_t (*start_recv)(uint8_t *buff, int32_t size);
    int32_t (*stop_recv)(void);
    int32_t (*recv_count)(void);
    
    int32_t (*poll_send)(uint8_t *buff, int32_t size);
    int32_t (*poll_recv)(uint8_t *buff, int32_t size);
}console_dev_ops_t;


void console_init(console_dev_ops_t *ops);

int32_t console_send(uint8_t *buf, int32_t size);
int32_t console_recv(uint8_t *buf, int32_t size);
int32_t console_recv_buf_size(void);

#ifdef CONSOLE_USE_ASNYC_SEND
void console_send_done(void);
#endif

#ifdef CONSOLE_USE_ASNYC_RECV
void console_recv_done(void);
void console_check_recv_idle(void);
#endif

void console_task_init(void);

#endif//_INCLUDE_CONSOLE_H
